package collection;

import java.util.ArrayList;
import java.util.Collection;

public class Demo02 {
  public static void main(String[] args) {
    Collection<String> col = new ArrayList<String>();
    col.add("aaaa");
    col.add("bbbb");
    System.out.println(col);
    /**
     * 是否包含
     */
    System.out.println(col.contains("aaaa"));
    Boolean res1 = col.remove("aaaa");
    System.out.println(res1);
    Boolean res2 = col.remove("vvvv");
    System.out.println(res2);
    /**
     * 条件删除
     */
    Boolean res3 = col.removeIf(
        (String s) -> {
          return s.length() == 4;
        });
    System.out.println(res3);
    System.out.println(col);
    /**
     * 移除集合内所有元素
     */
    col.clear();
    /**
     * 判断集合是否为空集合
     */
    Boolean result = col.isEmpty();
    System.out.println(result);
  }
}
